﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addrule.aspx.cs" Inherits="orgman_models_addrule" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>添加准则</title>
    <link href="../../css/main.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            text-align: right;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="boot">
        <div id="content">  
            <div align="left">当前模型：<asp:Label ID="lb_currentmodel" runat="server" Text=""></asp:Label>
            <asp:HyperLink ID="HyperLink1"
                runat="server" Text="返回模型列表" NavigateUrl="editlist.aspx">返回模型列表<img alt="" src="../../images/arrowRight.png" /></asp:HyperLink>
                </div>
            <hr style="color: #3399FF" />
           <div align="center" style="font-size: 14px">添加新的准则</div>
            <table style="width:700px;" class="dataTable">
                <tr>
                    <td align="center" colspan="3">
            <asp:Table ID="Table1" runat="server" Width="100%">
                <asp:TableRow runat="server">
                    <asp:TableCell runat="server">选项</asp:TableCell>
                    <asp:TableCell runat="server">准则名称</asp:TableCell>
                    <asp:TableCell runat="server">准则描述</asp:TableCell>
                </asp:TableRow>
            </asp:Table>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <asp:Image ID="Image2" runat="server" ImageUrl="~/images/101.png" />
                        <asp:LinkButton ID="lbt_add" runat="server" onclick="lbt_add_Click">增加选项</asp:LinkButton>
                    </td>
                    <td>
                        <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">
                            <asp:Image ID="Image1" runat="server" ImageUrl="~/images/save.gif" /></asp:LinkButton>
            <asp:Label ID="Label2" runat="server" Text=""></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Image ID="Image3" runat="server" ImageUrl="~/images/1.png" />
                        <asp:LinkButton ID="lbt_minus" runat="server" onclick="lbt_minus_Click">减少选项</asp:LinkButton>
                    </td>
                </tr>
            </table>
    <asp:Label ID="lb" runat="server" style="color: #FF0000"></asp:Label>
            <hr style="color: #3399FF" />
               <div align="left">已有的准侧：</div> 
            <div>
               <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:appConnectionString %>" 
                    DeleteCommand="DELETE FROM [rule] WHERE [ruleid] = @ruleid" 
                    InsertCommand="INSERT INTO [rule] ([modelid], [rulename], [description]) VALUES (@modelid, @rulename, @description)" 
                    SelectCommand="SELECT [rule].ruleid, [rule].modelid, [rule].rulename, [rule].description, model.modelname FROM [rule] INNER JOIN model ON [rule].modelid = model.modelid WHERE ([rule].modelid = @modelid)" 
                    
                    UpdateCommand="UPDATE [rule] SET [rulename] = @rulename, [description] = @description WHERE [ruleid] = @ruleid">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="modelid" QueryStringField="modelid" 
                            Type="Int32" />
                    </SelectParameters>
                    <DeleteParameters>
                        <asp:Parameter Name="ruleid" Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="rulename" Type="String" />
                        <asp:Parameter Name="description" Type="String" />
                        <asp:Parameter Name="ruleid" Type="Int32" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="modelid" Type="Int32" />
                        <asp:Parameter Name="rulename" Type="String" />
                        <asp:Parameter Name="description" Type="String" />
                    </InsertParameters>
                </asp:SqlDataSource>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                    CellPadding="4" DataKeyNames="ruleid" DataSourceID="SqlDataSource1" 
                    Width="700px" ForeColor="#333333" GridLines="Vertical" 
                    CssClass="dataTable">
                    <FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <Columns>
                        <asp:BoundField DataField="ruleid" InsertVisible="False" 
                            ReadOnly="True" SortExpression="ruleid" ItemStyle-Width="60px" 
                            Visible="False" >
<ItemStyle Width="60px"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="modelid" 
                            SortExpression="modelid" ReadOnly="True" ItemStyle-Width="60px" 
                            Visible="False" >
<ItemStyle Width="60px"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="rulename" HeaderText="准则名称" 
                            SortExpression="rulename" >
                        </asp:BoundField>
                        <asp:BoundField DataField="description" HeaderText="描述" 
                            SortExpression="description" />
                        <asp:CommandField DeleteText="&lt;img class='imgborder' src='../../images/delete.gif' alt='删除' /&gt;" 
                            EditText="&lt;img class='imgborder' src='../../images/modify...gif' alt='编辑' /&gt;" 
                            ShowDeleteButton="True" ShowEditButton="True" ItemStyle-Width="120px" >
<ItemStyle Width="120px"></ItemStyle>
                        </asp:CommandField>
                        <asp:HyperLinkField Text="&gt;&gt;模型指标" 
                            ItemStyle-Width="6px" DataNavigateUrlFields="ruleid,modelid,rulename,modelname" 
                            
                            
                            DataNavigateUrlFormatString="addindicator.aspx?ruleid={0}&amp;modelid={1}&amp;rulename={2}&amp;modelname={3}" >
<ItemStyle Width="90px"></ItemStyle>
                        </asp:HyperLinkField>
                    </Columns>
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <EmptyDataTemplate>
                        您当前的模型下还没有任何准则，请添加。
                    </EmptyDataTemplate>
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#999999" />
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                </asp:GridView>
            </div>
            
        </div>
    </div>
    </form>
</body>
</html>
